package com.cskaoyan.shopping.service.impl;

import com.cskaoyan.mall.dto.ItemDto;
import com.cskaoyan.shopping.converter.ProductConverter;
import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dal.persistence.ItemMapper;
import com.cskaoyan.shopping.service.IItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Aurhor: 帅的一批
 * @CreateAt: 2022/11/1 22:30
 * @Description:
 * @PACKAGE_NAME： com.cskaoyan.shopping.service.impl
 */

@Service
public class IItemServiceImpl implements IItemService {

    @Autowired
    ItemMapper itemMapper;

    @Autowired
    ProductConverter productConverter;

    @Override
    public List<ItemDto> getAllItem() {
        List<Item> itemList = itemMapper.selectAll();
        List<ItemDto> itemDtos = productConverter.items2ItemDtos(itemList);
        return itemDtos;
    }
}
